package com.action;

import com.pojo.Subject;
import com.service.SubjectService;
import com.vo.ResponseBean;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/subject")
@CrossOrigin("*")
public class SubjectAction {
    @Autowired
    private SubjectService subjectService;


    /**
     *  查询所有任课科目
     * @return
     */
    @RequestMapping("/findBySubjectId")
    public ResponseBean findBySubjectId(){
        // 查询已任课科目
        List<Subject> list=subjectService.findBySubjectId();
        if(list!=null) {
            return new ResponseBean(200,0,list);
        }
        return new ResponseBean(500,0,null);
    }

}
